package com.kede.dao;

import com.kede.entity.Release;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 【请填写作者】
 * @since 2020-04-02
 */
@Repository
public interface ReleaseDao extends BaseMapper<Release> {

    @Update("UPDATE `release` SET `status` = '删除' WHERE id = #{id}")
    int deleteReleaseById(@Param("id") Integer id);

    @Select("SELECT * FROM `release` WHERE title like #{title} limit #{page},#{limit}")
    List<Release> releaseSreachByTitle(@Param("title") String title,@Param("page") Integer page,@Param("limit") Integer limit);

    @Select("SELECT COUNT(*) FROM `release` WHERE title = #{title}")
    Integer countByTitle(@Param("title") String title);

}
